﻿$(function () {
    var swiper1 = new Swiper('.swiper', {
        pagination: '.swiper-pagination1',
        paginationClickable: true,
        spaceBetween: 0,
        grabCursor: true,
        loop: $(".swiper-wrapper0 > div").length > 1 ? true : false,
        autoplay: 5000,
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
        autoplayDisableOnInteraction: false
    });

    $(".swiper").mouseenter(function() {
        swiper1.stopAutoplay();
    }).mouseleave(function() {
        swiper1.startAutoplay();
    });

    //banner end

   
    bannerBarCtr();
    $(window).resize(function () {
        bannerBarCtr();
    });

    function bannerBarCtr() {
        var windowWidthBanner = $(window).width();
        if (windowWidthBanner > 1200) {
            $(".swiper-button-prev").css("left", ((windowWidthBanner - 1200) / 2 - 40) + "px");
            $(".swiper-button-next").css("right", ((windowWidthBanner - 1200) / 2 - 40) + "px");
        } else {
            $(".swiper-button-prev").css("left", "10px");
            $(".swiper-button-next").css("right", "10px");
        }
    };
    bannerbar();
    $(window).resize(function() {
        bannerbar();
    });

    function bannerbar() {
        if (($(window).width() - 1200) > 0) {
            $(".swiper-container-horizontal>.swiper-pagination-bullets").css("left", ($(window).width() - 1200) / 2);
        } else {
            $(".swiper-container-horizontal>.swiper-pagination-bullets").css("left", 0);
        }
    }
})